package lookas.track;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;

public class GPSPosition implements Comparable<GPSPosition>{

    protected Calendar date;
    protected Point    position;

    public Point getPosition(){
        return position;
    }

    public void setPosition(Point position){
        this.position = position;
    }

    public Calendar getDate(){
        return date;
    }

    public void setDate(Calendar time){
        this.date = time;
    }

    protected GPSPosition(){}

    public GPSPosition(Date date, Point point){
        this.position = point;
        this.date = Calendar.getInstance();
        this.date.setTime(date);
    }

    @Override
    public String toString(){
        DateFormat df = DateFormat.getDateTimeInstance();
        return df.format(date) + " (" + position + ")";
    }

    public int compareTo(GPSPosition o){
        return this.getDate().compareTo(o.getDate());
    }
}
